<extend name="Public:index" />
<block name="main-crumb">
 <li>
                <i class="ace-icon fa fa-home home-icon"></i>
                <a href="javascript:void(0);" onclick="onUrl('{:U(\'role/index\')}')">角色列表</a>
            </li>
            <li class="active">权限设置</li>
</block>
<block name="main-content">
       <div class="page-header text-center">
            <h1>


                    【{$info.name}】权限设置

            </h1>
        </div><!-- /.page-header -->
       <form action="__APP__/web/SetAuthority/index" method="post" class="definewidth m20">
       <div class="page-content">
       <volist name="device_class" id="vo">
       <div class="widget-box transparent collapsed">
            <div class="widget-header widget-header-flat setauthtitle ">
                <h4 class="widget-title lighter">
                    <a href="#" data-action="collapse">
						{$vo[0]['class_name']}
                        <i class="ace-icon fa fa-chevron-down"></i>
                    </a>
                </h4>
                   <label class="position-relative">
                   <input type="checkbox" class="ace"  onclick="setSelected(this,{$vo[0]['class_id']},1)" <if condition="$vo[0]['control_status'] egt 1"> checked="true" </if> /><span class="lbl"> 可看</span>
                   </label>
                    <label class="position-relative">
                   <input type="checkbox" class="ace" onclick="setSelected(this,{$vo[0]['class_id']},2)" <if condition="$vo[0]['control_status'] egt 2"> checked="true" </if>  /><span class="lbl"> 可控</span>
                   </label>

            </div>
            <div class="widget-body" style="display:none">
                <div class="widget-main no-padding">
                    <table class="table table-bordered table-striped">
                        <tbody>
                       <volist name="vo" id="sub">
                        <tr>
                            <td>
                                 <label class="position-relative">
                                   {$sub.show_name}
                                </label>
                            </td>
                            <td>
                            <label class="position-relative">
                                    <input type="checkbox" class="ace" tag="{$sub.class_id}_1" name="data[{$sub.class_id}_{$sub.cpn_id}_1]"  id="{$sub.class_id}_{$sub.cpn_id}_1"  <if condition="$sub.control_status egt 1"> checked="true" </if> />
                                    <span class="lbl"> 可看</span>
                            </label>
                            </td>
                            <td >
                             <label class="position-relative">
                                    <input type="checkbox" class="ace" tag="{$sub.class_id}_2" name="data[{$sub.class_id}_{$sub.cpn_id}_2]"  id="data['{$sub.class_id}_{$sub.cpn_id}_2']"  <if condition="$sub.control_status egt 2"> checked="true" </if> />
                                    <span class="lbl"> 可控</span>
                                </label>
                            </td>

                            <td class="cansetting">
                                   <a onclick="OnShowModal({$sub.cpn_id},{$info.id},{$sub.class_id},{$type})">高级设置</a>
                            </td>
                        </tr>
                        </volist>
                         </tbody>
                        </table>
                </div><!-- /.widget-main -->
            </div><!-- /.widget-body -->
        </div><!-- /.widget-box -->
        </volist>

        <div style="text-align: center;margin-top:30px;">
          <input type="hidden" name="id" value="{$info.id}">
          <input type="hidden" name="t" value="{$type}">
          <input type="hidden" name="name" value="{$info.name}">
          <input type="submit" class="btn btn_primary" id="sub" name="sub" value="设置" />&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;
          <input type="reset" class="btn btn-success" value="重置" />

        </div>
        </form>
        <div class="col-xs-12">
                <div class="modal fade" id="ajax" role="basic" aria-hidden="true">

                    <div class="modal-dialog">
                           <div class="modal-content" id="modal_cont">
                           </div>
                    </div>


                </div>
           </div>
       </div>
   </block>
   <block name="myscript">

     <script type="text/javascript">
     window.onload=function(){
          document.getElementsByTagName('body')[0].style.height=window.innerHeight*3+'px';

     }



      function setSelected(obj,class_id,value) {

               $("[tag='"+class_id+"_"+value+"']").each(function(){
                    if(obj.checked){
                         $(this).attr("checked",'true');
                         $(this).prop("checked",'true');
                    }else{
                         $(this).removeAttr("checked");
                    }

               });

      }
      function OnShowModal(cpn_id,roleid,class_id,$type){
        //$("#ajax").draggable();
           $('#ajax').removeData("bs.modal");
           $("#ajax").draggable();
           $('#ajax').modal({remote:root_url + "/web/SetAuthority/detail?cpn_id="+cpn_id+"&roleid="+roleid+"&class_id="+class_id+"&type="+$type});
     }
     </script>
      </block>
      <block name='mycss'>
       <style>
             .setauthtitle{
                 background:rgb(114,178,224)!important;
                 color:#fff!important;
             }
             .setauthtitle a{
                 text-decoration: none;
                 color: white;
             }
            .setauthtitle .widget-title{
               display: inline-block;
               width: 20%;

            }
             .setauthtitle label{
               width: 20%;

             }
             .table>tbody>tr>td{
                 width: 20% ;
             }
             input[type=checkbox]{
                 margin-right: 5px;
             }
             .page-content{
                 padding: 20px 30px;
             }
             .widget-box{
                 margin: 0 20px;
             }
             .page-header{
                 margin: 0;
                 background: white;
             }
             #move .widget-box{
               margin: 0!important;
               padding-bottom:20px;
             }
             .cansetting a{
                 cursor: pointer;
                text-decoration: none;

             }
        </style>
      </block>
